﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QCheckBox>
#include <QLineEdit>
#include <QPushButton>
#include <QSerialPort>
#include <QTimer>
#include <QWidget>
#include "mycustomthread.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private slots:
    void on_btn_openCloseSer_clicked();

    void on_btn_send_clicked();

    void on_recvData();

    void on_checkBox_autoSend_clicked(bool checked);

    void on_btn_revClear_clicked();

    void on_btn_revSave_clicked();
    void getSysTime();
    void on_checkBox_revTime_clicked(bool checked);

    void on_checkBox_HEX_clicked(bool checked);

    void on_btn_hideBoard_clicked(bool checked);

    void on_btn_hidHistory_clicked(bool checked);

    void refresh_serPort();
    void on_command_button_clicked();
    /*
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_10_clicked();
    */

    void on_checkBox_recycleSend_clicked(bool checked);

    void on_timerConButton();

    void on_btnInit_clicked();

    void on_btnSave_clicked();

    void on_btnLoad_clicked();

private:
    Ui::Widget *ui;
    QSerialPort *serialPort;
    int sendCountTotal,recvCountTotal;
    QString sendBak;
    bool serialState;
    QTimer *timer;
    QString myTime;
    QString saveTime;
    bool recvTimeState;
    QList<QPushButton *> buttons;
    QList<QLineEdit *> lineEdits;
    QList<QCheckBox *> checkBoxs;
    QTimer *buttonConTimer;
    int btnCount;
    MyCustomThread *myThread;
};
#endif // WIDGET_H
